home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
The CICA Windows Explosion!
/
The CICA Windows Explosion! - Disc 2.iso
/
demo
/
demow32s.zip
/
SOURCE.ZIP
/
USECT3D.CPP
< prev
next >
Wrap
C/C++ Source or Header
|
1993-06-06
|
5KB
|
166 lines
#include <windows.h>
#include <windowsx.h>
#include <commdlg.h>
#include <shellapi.h>
#include <string.h>
#include <stdlib.h>
#include "usect3d.h"
#ifndef CTL3D_ALL
#define CTL3D_ALL 0xffff
#endif
#ifdef WIN32
#define _export
#endif
static HINSTANCE hInstCtl3D = NULL;
static BOOL fCtlLoad = FALSE;
static LPFNHOOK CDHook = NULL;
BOOL CALLBACK _export CDLGProc(HWND hwnd,int wm,WPARAM wParam,LPARAM lParam)
{
switch(wm)
{
case WM_INITDIALOG:
useCtl3dSubclassDlg(hwnd,CTL3D_ALL);
break;
//case WM_CTLCOLOR:
// return (UINT)GetStockObject(GRAY_BRUSH);
// case WM_CTLCOLOR:
// return (UINT)useCtl3dCtlColorEx(wm, wParam, lParam);
}
return FALSE;
}
LPFNHOOK GetCDLGProc(void)
{
if (!fCtlLoad) return NULL;
return CDHook;
}
BOOL GetCtl3dState(void)
{
return fCtlLoad;
}
BOOL LoadRegistCtlModule(HANDLE hInst)
{
typedef BOOL (FAR PASCAL *LPCTL3DREGISTER) (HANDLE);
LPCTL3DREGISTER lpCtl3dRegister;
#ifdef WIN32
hInstCtl3D = LoadLibrary("CTL3D32.DLL");
fCtlLoad = (hInstCtl3D != NULL) ;
#else
hInstCtl3D = LoadLibrary("CTL3D.DLL");
fCtlLoad = (hInstCtl3D > HINSTANCE_ERROR);
#endif
if (fCtlLoad)
{
lpCtl3dRegister =
(LPCTL3DREGISTER)GetProcAddress(hInstCtl3D,"Ctl3dRegister");
if (lpCtl3dRegister == NULL)
{
FreeLibrary(hInstCtl3D);
fCtlLoad = FALSE;
}
else
{
(*lpCtl3dRegister)(hInst);
//CDHook = (LPFNHOOK)MakeProcInstance((FARPROC)CDLGProc,hInst);
CDHook = (LPFNHOOK)CDLGProc;
}
}
return fCtlLoad;
}
BOOL useCtl3dUnregister(HANDLE hInst)
{
BOOL fRet;
typedef BOOL (FAR PASCAL *LPCTL3DUNREGISTER) (HANDLE);
LPCTL3DUNREGISTER lpCtl3dUnregister;
if (!fCtlLoad) return FALSE;
//FreeProcInstance((FARPROC)CDHook);
lpCtl3dUnregister =
(LPCTL3DUNREGISTER)GetProcAddress(hInstCtl3D,"Ctl3dUnregister");
if (lpCtl3dUnregister == NULL) return FALSE;
fRet = (*lpCtl3dUnregister)(hInst);
FreeLibrary(hInstCtl3D);
return fRet;
}
BOOL useCtl3dAutoSubclass(HANDLE hInst)
{
typedef BOOL (FAR PASCAL *LPCTL3DAUTOSUBCLASS) (HANDLE);
LPCTL3DAUTOSUBCLASS lpCtl3dAutoSubClass;
if (!fCtlLoad) return FALSE;
lpCtl3dAutoSubClass =
(LPCTL3DAUTOSUBCLASS)GetProcAddress(hInstCtl3D,"Ctl3dAutoSubclass");
if (lpCtl3dAutoSubClass == NULL) return FALSE;
return (*lpCtl3dAutoSubClass)(hInst);
}
BOOL useCtl3dSubclassDlg(HWND hWnd, WORD word)
{
typedef BOOL (FAR PASCAL * LPCTL3DSUBCLASSDLG) (HWND hWnd, WORD word);
LPCTL3DSUBCLASSDLG lpCtl3dSubclassDlg;
//MessageBox(0,"a","A",0);
if (!fCtlLoad) return FALSE;
lpCtl3dSubclassDlg =
(LPCTL3DSUBCLASSDLG) GetProcAddress(hInstCtl3D,"Ctl3dSubclassDlg");
if (lpCtl3dSubclassDlg == NULL) return FALSE;
//MessageBox(0,"B","B",0);
return (*lpCtl3dSubclassDlg)(hWnd,word);
}
BOOL useCtl3dSubclassCtl(HWND hWnd)
{
typedef BOOL (FAR PASCAL * LPCTL3DSUBCLASSCTL) (HWND hWnd);
LPCTL3DSUBCLASSCTL lpCtl3dSubclassCtl;
if (!fCtlLoad) return FALSE;
lpCtl3dSubclassCtl =
(LPCTL3DSUBCLASSCTL) GetProcAddress(hInstCtl3D,"Ctl3dSubclassCtl");
if (lpCtl3dSubclassCtl == NULL) return FALSE;
return (*lpCtl3dSubclassCtl)(hWnd);
}
BOOL useCtl3dColorChange(void)
{
typedef BOOL (FAR PASCAL *LPUSECTL3DCOLORCHANGE)(void);
LPUSECTL3DCOLORCHANGE lpCtl3dColorChange;
if (!fCtlLoad) return FALSE;
lpCtl3dColorChange =
(LPUSECTL3DCOLORCHANGE) GetProcAddress(hInstCtl3D,"Ctl3dColorChange");
if (lpCtl3dColorChange == NULL) return FALSE;
return (*lpCtl3dColorChange)();
}
HBRUSH useCtl3dCtlColorEx(UINT wm, WPARAM wParam, LPARAM lParam)
{
typedef HBRUSH (FAR PASCAL * LPCTL3DCTLCOLOREX)(UINT wm, WPARAM wParam, LPARAM lParam);
LPCTL3DCTLCOLOREX lpCtl3dCtlColorEx;
if (!fCtlLoad) return FALSE;
lpCtl3dCtlColorEx =
(LPCTL3DCTLCOLOREX) GetProcAddress(hInstCtl3D,"Ctl3dCtlColorEx");
if (lpCtl3dCtlColorEx == NULL) return FALSE;
return (*lpCtl3dCtlColorEx)(wm,wParam,lParam);
}
LONG useCtl3dDlgFramePaint(HWND hwnd, UINT ui, WPARAM wp, LPARAM lp)
{
typedef LONG (FAR PASCAL *LPCTL3DDLGFRALEPAINT)(HWND, UINT, WPARAM, LPARAM);
LPCTL3DDLGFRALEPAINT lpCtl3dDlgFramePaint;
if (!fCtlLoad) return FALSE;
lpCtl3dDlgFramePaint =
(LPCTL3DDLGFRALEPAINT)GetProcAddress(hInstCtl3D,"Ctl3dDlgFramePaint");
if (lpCtl3dDlgFramePaint == NULL) return FALSE;
return (*lpCtl3dDlgFramePaint)(hwnd,ui,wp,lp);
}